package com.iman.fetion.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.iman.fetion.FetionMessage;

public class UpdataPwdServlet extends HttpServlet {

	/**
	 * The doGet method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to get.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
//		String body = "MobileNo=" + tmpMobile + "&Password=" + newPassword
//		+ "&SmsCode=" + smsCode;
		
		String smsCode=request.getParameter("smsCode");
		String newPassword=request.getParameter("newPassword");
		String tmpMobile=request.getParameter("tmpMobile");
		
		FetionMessage fetion=new FetionMessage();	
		
		fetion.smsCode=smsCode;
		fetion.newPassword=newPassword;
		fetion.tmpMobile=tmpMobile;
		
		fetion.updatePwd();
		
		System.out.println("UpdatePwd tmpMobile="+tmpMobile+" smsCode="+smsCode+" newPassword="+newPassword);
		
		
		response.setContentType("text/xml");
		PrintWriter out = response.getWriter();
		out.write("<OK/>");
		out.flush();
		out.close();
	}

}
